from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import JsonResponse


# 继承LoginRequiredMixin重写handle_no_permission方法使其返回JSON数据
class LoginRequiredJSONMixin(LoginRequiredMixin):
    def handle_no_permission(self):
        return JsonResponse({'code': 0, 'errmsg': 'ok'})